<?php echo $header; ?>



		  <!-- Start - Left Side -->
	      <div id="left" class="span-24 ">
	      	<div id="account_invoice" class="span-24 checkout invoice">
	    			<div class="heading_x span-24">
					<span><?php echo $heading_title; ?></span><hr />
				</div>
				&nbsp;
	    		<div class="content">
				
      <table width="536">
        <tr>
          <td width="33.3%" valign="top"><?php if ($invoice_id) { ?>
            <b><?php echo $text_invoice_id; ?></b><br />
            <?php echo $invoice_id; ?><br />
            <br />
            <?php } ?>
            <b><?php echo $text_order_id; ?></b><br />
            #<?php echo $order_id; ?><br />
            <br />
            <b><?php echo $text_email; ?></b><br />
            <?php echo $email; ?><br />
            <br />
            <b><?php echo $text_telephone; ?></b><br />
            <?php echo $telephone; ?><br />
            <br />
            <?php if ($fax) { ?>
            <b><?php echo $text_fax; ?></b><br />
            <?php echo $fax; ?><br />
            <br />
            <?php } ?>
            <?php if ($shipping_method) { ?>
            <b><?php echo $text_shipping_method; ?></b><br />
            <?php echo $shipping_method; ?><br />
            <br />
            <?php } ?>
            <b><?php echo $text_payment_method; ?></b><br />
            <?php echo $payment_method; ?></td>
          <td width="33.3%" valign="top"><?php if ($shipping_address) { ?>
            <b><?php echo $text_shipping_address; ?></b><br />
            <?php echo $shipping_address; ?><br />
            <?php } ?></td>
          <td width="33.3%" valign="top"><b><?php echo $text_payment_address; ?></b><br />
            <?php echo $payment_address; ?><br /></td>
        </tr>
      </table>
    </div>
    <div class="content">
      <table width="536">
        <tr>
          <th align="left"><?php echo $text_product; ?></th>
          <th align="left"><?php echo $text_model; ?></th>
          <th align="right" class="tb_right"><?php echo $text_quantity; ?></th>
          <th align="right" class="tb_right"><?php echo $text_price; ?></th>
          <th align="right" class="tb_right"><?php echo $text_total; ?></th>
        </tr>
        <?php foreach ($products as $product) { ?>
        <tr>
          <td align="left" valign="top"><?php echo $product['name']; ?>
            <?php foreach ($product['option'] as $option) { ?>
            <br />
            &nbsp;<small> - <?php echo $option['name']; ?> <?php echo $option['value']; ?></small>
            <?php } ?></td>
          <td align="left" valign="top"><?php echo $product['model']; ?></td>
          <td align="right" valign="top"  class="tb_right"><?php echo $product['quantity']; ?></td>
          <td align="right" valign="top" class="tb_right"><?php echo $product['price']; ?></td>
          <td align="right" valign="top" class="tb_right"><?php echo $product['total']; ?></td>
        </tr>
        <?php } ?>
      </table>
      <br />
      <div style="width: 100%; display: inline-block;text-align:right;">
          <?php foreach ($totals as $total) { ?>
          	
          	<span id="invoice_label"><b><?php echo $total['title']; ?></b></span> <span id="invoice_value"><?php echo $total['text']; ?></span><br/>
          	
          
          <?php } ?>
      </div>
    </div>
    <?php if ($comment) { ?>
    <b style="margin-bottom: 2px; display: block;"><?php echo $text_comment; ?></b>
    <div class="content"><?php echo $comment; ?></div>
    <?php } ?>
    <?php if ($historys) { ?>
    <b style="margin-bottom: 2px; display: block;"><?php echo $text_order_history; ?></b>
    <div class="content" id="tab_history2">
      <table width="536" class ="form">
        <tr>
          <th align="left"><?php echo $column_date_added; ?></th>
          <th align="left"><?php echo $column_status; ?></th>
          <th align="left"><?php echo $column_comment; ?></th>
        </tr>
        <?php foreach ($historys as $history) { ?>
        <tr>
          <td valign="top"><?php echo $history['date_added']; ?></td>
          <td valign="top"><?php echo $history['status']; ?></td>
		  
		  
          <td valign="top"><?php if($history['status']=="Shipped"){echo $text_tracklink."</BR>".$history['comment'];}else {echo $history['comment'];}?></td>
        </tr>
        <?php } ?>
      </table>
    </div>
    <?php } ?>
	<b style="margin-bottom: 2px; display: block;"><?php echo $text_userpayment; ?></b>
	<div class="content" id="tab_history">
	<table class="form">
          
          
		  <input type="hidden" name="order_status_id" value="14" >
		  <tr>
            <td><?php echo $entry_transferto; ?></td>
            <td><select name="transferto" style= "width:250px ">
				<option value="0"><?php echo $text_select; ?></option>
				<?php foreach ($bankinfos as $bankinfo) { ?>
				<option value="<?php echo $bankinfo['name']; ?> <?php echo $bankinfo['number']; ?>"><?php echo $bankinfo['name']; ?> <?php echo $bankinfo['number']; ?></option>
				
                <?php }?>
              </select> <div style="display:inline; color:#ff0000;" id="text_1"></div></td>
          </tr>
		  
		  <tr>
            <td><?php echo $entry_date; ?></td>
            <td><input type="text" name="date" id="datepicker"><div style="display:inline; color:#ff0000;" id="text_2"></div></td>
          </tr>
		  
		  
		  <tr>
            <td><?php echo $entry_time; ?></td>
            <td>
			<select name="time_h" style= "width:50px " >
			<?php for($i=0; $i<24; $i++){
			if($i<10){$i='0'.$i;}
			echo "<option value=".$i.">".$i."</option>";
			}
			?>
			
              
              </select> : 
			<select name="time_m" style= "width:50px " >
			<?php for($i=0; $i<60; $i++){
			if($i<10){$i='0'.$i;}
			echo "<option value=".$i.">".$i."</option>";
			}
			?>
              </select>   
			  
			  
			  </td>
          </tr>
		  
		  

          <tr>
		  <input type="hidden" name="notify" value="1" >
		  <input type="hidden" name="append" value="1" >
          
            <td><?php echo $entry_comment; ?></td>
            <td><textarea name="comment" style="width: 99%"></textarea>
            	<div class="galib_btn1 float_right">
            		<a onclick="history();" id="history_button"><span><?php echo $button_add_history; ?></span></a>
        </div>
            	
              </td>
          </tr>
		  
        </table>
	</div>
    <div class="buttons">
    	
    	<div class="galib_btn2 float_right">
            		<a onclick="location = '<?php echo str_replace('&', '&amp;', $continue); ?>'" ><span><?php echo $button_continue; ?></span></a>
        </div>
    	<div style="clear:both"></div>
     
    </div>
</div> 
</div>
       	 <!-- End - Left Side -->
       	 
       	 


<?php echo $footer; ?> 


<script type="text/javascript"><!--

$(function() {
		$( "#datepicker" ).datepicker({dateFormat: 'yy-mm-dd', showOn: 'both', 
            buttonImageOnly: true, 
			buttonImage: 'catalog/view/theme/<?php echo $template; ?>/image/calendar.gif'});
	});

function history() {
$('#text_1').text('');
$('#text_2').text('');
$('.success, .warning').remove();
	if($('select[name=\'transferto\']').val()==0){$('#text_1').text('PLEASE SELECT ACCOUNT');}
	else if($('input[name=\'date\']').val()==''){$('#text_2').text('PLEASE CHOOSE DATE');}
	else{
	$.ajax({
		type: 'POST',
		url: 'index.php?route=account/invoice/history&order_id=<?php echo $order_id; ?>',
		dataType: 'json',
		data: 'order_status_id=' + encodeURIComponent($('input[name=\'order_status_id\']').val()) + '&notify=' + encodeURIComponent($('input[name=\'notify\']').val()) + '&append=' + encodeURIComponent($('input[name=\'append\']').val()) + '&comment=' + encodeURIComponent($('select[name=\'transferto\']').val()) + '\n TIME: ['+ encodeURIComponent($('input[name=\'date\']').val()) + ']%20[' + encodeURIComponent($('select[name=\'time_h\']').val()) + ':' + encodeURIComponent($('select[name=\'time_m\']').val()) +'] \n'  + encodeURIComponent($('textarea[name=\'comment\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#history_button').attr('disabled', 'disabled');
			$('#tab_history .form').before('<div class="attention"><img src="catalog/view/theme/default/image/loading_1.gif" alt="" /> </div>');
		},
		complete: function() {
			$('#history_button').attr('disabled', '');
			$('.attention').remove();
		},
		success: function(data) {
			
				
				
				html = '    <tr>';
				html += '        <td valign="top">' + data.date_added + '</td>';
				html += '        <td valign="top">' + data.order_status + '</td>';
				html += '        <td valign="top">' + data.comment + '</td>';
				html += '    </tr>';
				
			
				

				$('#tab_history2 .form').append(html);

				$('#tab_history2 .history').slideDown();

				$('#tab_history .form').before('<div class="success">' + data.success + '</div>');

				$('textarea[name=\'comment\']').val('');
		
		}
			
	})
	};
}
//--></script>
<script type="text/javascript"><!--
$.tabs('.vtabs a');
//--></script>
